<div>
<h1>Добавление изображения</h1>
<form action="{%link[{%class%},index]%}" method="post" enctype="multipart/form-data">
<input type="hidden" name="edit" value="1" />
<table>
<tr>
   <td class="w150" valign="top">
      Заголовок <span class="required">*</span>
   </td>
   <td align="left">
      <input type="text" name="title" value="{%title%}" class="i" size="30" />
      {%error_title%}
   </td>
</tr>
<tr>
   <td class="w100" valign="top">
      Изображение <span class="required">*</span>
   </td>
   <td>
      <input type="hidden" name="hidden_image" value="{%image%}" />
      <input type="file" name="image" size="30" class="i" />
      {%error_image%}
   </td>
</tr>
{%image_exists%}
<tr id="preview_image">
   <td class="w100" valign="top">
      &nbsp;
   </td>
   <td nowrap="nowrap">
      <img src="{%base_url%}{%widget[thumbnail,src={%image%},size=100x100]%}" alt="" align="left" />
      <img src="{%base_url%}images/admin/delete.gif" alt="" title="Удалить" onclick="remove_image()" />
   </td>
</tr>
{%/image_exists%}
<tr>
   <td colspan="2">
      &nbsp;
   </td>
</tr>
<tr>
   <td colspan="2">
      <input type="submit" value="Добавить" class="b" />
   </td>
</tr>
</table>
</form>
</div>
<script type="text/javascript">
function remove_image() {
   jQuery('input[name=hidden_image]').val('');
   jQuery('#preview_image').remove();
}
</script>
